package com.wkbb.basic.thread;

import com.wkbb.basic.service.UserOpenService;
import com.wkbb.basic.service.WebankService;
import com.wkbb.basic.utils.FileUtil;
import com.wkbb.basic.utils.ImageOfbase64UtilDto;
import com.wkbb.basic.utils.WebankUtil;
import com.wkbb.common.constants.ErrorCode;
import com.wkbb.common.dto.ResultDTO;
import lombok.extern.slf4j.Slf4j;

import java.net.URL;

/**
 * @author dengjingyuan
 * @date 2020-06-10 21:39
 */
@Slf4j
public class BasicSynAddWeBankUserFaceTask implements Runnable {

    private WebankService webankService;

    private String picUrlA;

    private String userCode;

    private Long orgId;

    private Long accountId;

    private Long userId;

    public BasicSynAddWeBankUserFaceTask(WebankService webankService, String picUrlA, String userCode, Long orgId, Long accountId, Long userId) {
        this.webankService = webankService;
        this.picUrlA = picUrlA;
        this.userCode = userCode;
        this.orgId = orgId;
        this.accountId = accountId;
        this.userId = userId;
    }

    public BasicSynAddWeBankUserFaceTask() {

    }

    @Override
    public void run() {
        log.info("***********BasicSynAddWeBankUserFaceTask.synAddWeBankUserFace******picUrlA:{},userCode:{},orgId:{},accountId:{},userId:{},type:{},similar:{}", picUrlA, userCode, orgId, accountId, userId, 1, null);
        try {
            ResultDTO result = webankService.addWeBankUserFace(picUrlA, userCode, orgId, accountId, userId, 1, null);
            if (!ResultDTO.checkSuccess(result)) {
                log.info("----------未添加成功的人脸----------userId:{},picUrlA:{}",userId,picUrlA);
            }
        } catch (Exception e) {
            log.error("*******BasicTask**********synAddWeBankUserFace:{}", e);
        }
    }
}
